<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta charset="utf-8" />
    <title>{$current['title']}-{$Think.CONFIG.title}</title>
    <meta name="keywords" content="{$Think.CONFIG.keywords}" />
    <meta name="description" content="{$Think.CONFIG.description}" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
    <include file="Public/head" />
</head>
<body class="no-skin">
<include file="Public/header" />
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try{ace.settings.check('main-container' , 'fixed')}catch(e){}
    </script>
    <include file="Public/sidebar" />
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs" />
            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set" />
                <!-- /section:settings.box -->

                <div class="row">
                    <div class="page-content">
						<div class="page-content-area">
							<div class="row">
								<div class="col-xs-12">
									<!-- PAGE CONTENT BEGINS -->

									<!--/span-->
									<!-- left menu ends -->



									<form style="margin-bottom:10px;" class="form-inline">
										<div class="form-group">
											<div class="input-group">
												<input type="text" name="start_date" class="date_keyword" value="{$start_date}" placeholder="开始日期">
												<span class="input-group-addon">
													<span class=" ace-icon fa fa-calendar"></span>
												</span>
											</div>
										</div>
										<div class="form-group">
											<div class="input-group">
												<input type="text" name="end_date" class="date_keyword" value="{$end_date}" placeholder="结束日期">
												<span class="input-group-addon">
													<span class="ace-icon fa fa-calendar"></span>
												</span>
											</div>
										</div>
										<div class="form-group">
											<select id="search-name" name="agent_id" style="width: 310px;">
												<option value="0">选择代理</option>
												<volist name="agent" id="vo">
												<option <if condition="$agent_id eq $key">selected</if> value="{$key}">{$vo}</option>
												</volist>
											</select>
										</div>
										<input type="text" name="status" value="search" style="display:none">
										<button type="submit" class="btn btn-primary">查询</button>
										<!--
										<span style="display: inline-block;vertical-align: bottom;margin-left:10px;">
											<a href="#" data-toggle="filter-by-date" data-from="2017-09-06" data-to="2017-09-06">
												昨天
											</a>
											|
											<a href="#" data-toggle="filter-by-date" data-from="2017-09-05" data-to="2017-09-05">
												前天
											</a>
											|
											<a href="#" data-toggle="filter-by-date" data-from="2017-08-30" data-to="2017-09-06">
												最近7天
											</a>
										</span>-->
									</form>


										<div class="row">
											<div class="col-md-4">
												<div class="well">
													<b>充值总额 (不含未结算充值)</b>
													<div class="text-primary" style="font-size:32px;margin:5px 0">
														¥{$Income_data['total_money']}</div>
													<div style="font-size:14px" class="text-muted">
														充值笔数 <b class="text-warning">{$Income_data['success_num']}</b>
													</div>
												</div>
											</div>
											<div class="col-md-4">
												<div class="well">
													<b>结算总额</b>
													<div class="text-primary" style="font-size:32px;margin:5px 0">
														¥{$Income_data['total_income']}                </div>
													<div style="font-size:14px;" class="text-muted">
														<!--未提现 <b class="text-warning">¥{$Income_data['not_money']}</b>,
														提现中 <b class="text-warning">¥{$Income_data['apply_money']}</b>,
														已打款 <b class="text-warning">¥{$Income_data['play_money']}</b>-->
														&nbsp;
													</div>
												</div>
											</div>
											<div class="col-md-4">
												<div class="well">
													<b>代理分成</b>
													<div class="text-primary" style="font-size:32px;margin:5px 0">
														¥{$Income_data['total_member_income']}                </div>
													<div style="font-size:14px" class="text-muted">
																				进帐 <span class="text-warning">¥{$Income_data['total_member_money']}</span>,
																			成本 <span class="text-warning">¥{$Income_data['total_income']}</span>
													</div>
												</div>
											</div>
										</div>

									<div class="clearfix">
										<ul class="nav nav-tabs pull-left">
											<li class="<if condition="$status eq 'today'">active</if>">
												<a onclick="searchBills('today')">今日</a>
											</li>
											<li class="<if condition="$status eq '' || $status eq 'yesterday'">active</if>">
												<a onclick="searchBills('yesterday')">昨日</a>
											</li>
											<li class="<if condition="$status eq 'search'">active</if>">
												<a onclick="searchBills('search')">查询</a>
											</li>
										</ul>
									</div>

									<table class="table table-striped table-bordered table-hover responsive">
										<thead>
										<tr>
											<td>
												日期
											</td>
											<td>
												代理        </td>
													<td>
												总笔数
											</td>
											<td class="text-center">
												充值金额
											</td>
											<td class="text-center">
												帐单金额
											</td>
											<td class="text-center">
												佣金比例
											</td>
										</tr>
										</thead>
										<tbody>
											<if condition="$count eq 0">
											<tr>
												<td class="text-center" colspan="100">没有记录</td>
											</tr>
											<else/>
											<volist name="data" id="vo">
											<tr>
												<td>{$vo.bills_date|date='Y-m-d' , ###}</td>
												<td>{$vo.user}</td>
												<td>{$vo.num}</td>
												<td>￥{$vo.money}</td>
												<td>￥{$vo.income}</td>
												<td>{$vo.proportion}%</td>
											</tr>
											</volist>
											</if>
										</tbody>
									</table>

                                <!-- PAGE CONTENT ENDS -->
                            </div>
							</div><!-- /.page-content-area -->
						</div>
					</div><!-- /.row -->
				</div><!-- /.page-content -->
			</div>
		</div>
    </div><!-- /.main-content -->
<include file="Public/footer" />
</div><!-- /.main-container -->
<include file="Public/footerjs" />
<!-- inline scripts related to this page -->
<script src="__PUBLIC__/qwadmin/js/date-time/bootstrap-datepicker.js"></script>
<script type="text/javascript">
	$(function () {
		$('.date_keyword').datepicker({
            format: 'yyyy-mm-dd',
            weekStart: 1,
            autoclose: true,
            todayBtn: 'linked',
            language: 'cn'
        });
	});
	function searchBills(status) {
		var startime = $("input[name=start_date]").val();
        var endtime = $("input[name=end_date]").val();
		var search = $("#search-name").val();
		var url ='{:U('affiliate_bills')}';
		if(status=='today'){
			url ='{:U('affiliate_bills_today')}'
		}
		location.href = url+'?start_date='+startime+'&end_date='+endtime+'&agent_id='+search+'&status='+status;
	}
</script>
</body>
</html>